package org.zhadoop.stream.cql.semanticanalyzer.parser.context;

import java.util.List;

import org.zhadoop.stream.cql.DriverContext;
import org.zhadoop.stream.cql.exception.CQLException;
import org.zhadoop.stream.cql.exception.SemanticAnalyzerException;
import org.zhadoop.stream.cql.hooks.SemanticAnalyzeHook;
import org.zhadoop.stream.cql.semanticanalyzer.SemanticAnalyzer;
import org.zhadoop.stream.cql.semanticanalyzer.parsecontextwalker.ParseContextWalker;
import org.zhadoop.stream.cql.tasks.Task;

/**
 * from 解析内容
 * @author zwd
 *
 */
public class FromSourceContext extends ParseContext{

	private StreamBodyContext streamBody;
	
	private DataSourceBodyContext dataSoruceBody;
	
	@Override
	public String toString() {
		return streamBody != null ? streamBody.toString() : dataSoruceBody.toString();
	}

	public StreamBodyContext getStreamBody() {
		return streamBody;
	}

	public void setStreamBody(StreamBodyContext streamBody) {
		this.streamBody = streamBody;
	}
	

	public DataSourceBodyContext getDataSoruceBody() {
		return dataSoruceBody;
	}

	public void setDataSoruceBody(DataSourceBodyContext dataSoruceBody) {
		this.dataSoruceBody = dataSoruceBody;
	}

	@Override
	public Task createTask(DriverContext driverContext, List<SemanticAnalyzeHook> analyzeHooks) throws CQLException {
		return null;
	}

	@Override
	public SemanticAnalyzer createAnalyzer() throws SemanticAnalyzerException {
		return null;
	}

	@Override
	protected void walkChild(ParseContextWalker walker) {
		walkExpression(walker, streamBody);
		walkExpression(walker, dataSoruceBody);
	}
}
